<template>
  <div>
    <div class="demo-input-suffix gl_searchBox">
      <!-- table的选择条件 -->
      <el-row :gutter="20">
        <el-col :md="6" :lg="4">
          <p>按项目选择</p>
          <el-select v-model="Api_GET_EventsManagementEventResultEventRankListQO.CategoryId" size="mini" placeholder="请选择" filterable @change="findEventTabelDataList()">
            <el-option v-for="(data, endex) in eventType" :key="endex" :label="data.name" :value="data.id" />
          </el-select>
        </el-col>
      </el-row>
    </div>
    <!-- tabel表格 -->
    <div>
      <el-table key="a0" ref="rankTable" v-loading="loading" class="object_ank" :data="tableData" tooltip-effect="dark" style="width: 100%" size="mini">
        <el-table-column prop="eventName" label="项目名称" width="200" />
        <el-table-column label="金牌" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._1, '', 1, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._1" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._1, item.eventResultId, 1, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="银牌" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._2, '', 2, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._2" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._2, item.eventResultId, 2, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="铜牌" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._3, '', 3, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._3" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._3, item.eventResultId, 3, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="_4" label="第四名" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._4, '', 4, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._4" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._4, item.eventResultId, 4, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="_5" label="第五名" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._5, '', 5, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._5" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._5, item.eventResultId, 5, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="_6" label="第六名" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._6, '', 6, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._6" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._6, item.eventResultId, 6, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="_7" label="第七名" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._7, '', 7, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._7" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._7, item.eventResultId, 7, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="_8" label="第八名" min-width="190">
          <template slot-scope="{ row, $index }">
            <el-button v-if="row.isEdit" size="mini" type="text" @click="handlePeople(row.eventId, row._rankInfos._8, '', 8, $index, 'add')">添加</el-button>
            <div class="gl_mt_10">
              <div v-for="item in row._rankInfos._8" :key="item.name" style="display:inline-block">
                <div class="name_box" @click="loooDetails(item.registerId, row.registerTypeCode)">
                  <PersonalImage v-if="row.registerTypeCode == 'I'" :imgurl="item.imagePath" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.imagePath)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="row.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.registerName">
                    <span slot="reference" class="item_name">{{ item.registerName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.memberNames">
                    <span slot="reference" class="item_name">{{ item.memberNames }}</span>
                  </el-popover>
                </div>
                <p v-if="row.isEdit" class="operation">
                  <span @click="handlePeople(row.eventId, row._rankInfos._8, item.eventResultId, 8, $index, '')">更换人员</span>
                  <span class="gl_pl_10" @click="removePeople(item, $index)">删除</span>
                </p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="180">
          <template slot-scope="{row, $index}">
            <el-button v-if="!row.isEdit" size="mini" type="text" @click="isEdit($index, row)">编辑成绩</el-button>
            <div v-else>
              <el-button size="mini" type="text" @click="isEdit($index, row)">退出编辑状态</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-row class="gl_pt_20" style="text-align: center;">
        <el-pagination
          :current-page="Api_GET_EventsManagementEventResultEventRankListQO.Page"
          :page-size="Api_GET_EventsManagementEventResultEventRankListQO.MaxResultCount"
          :total="totalPage"
          layout="total,sizes,prev,pager,next,jumper"
          :page-sizes="[10, 20, 50, 100]"
          @size-change="sizeChange"
          @current-change="pageIndexChange"
        />
      </el-row>
    </div>

    <el-dialog title="成员信息" class="gl_dialog_TitleLine" :visible.sync="dialogVisible" width="30%">
      <div v-loading="athleteLoading" class="athlete_box">
        <div v-if="athlete && athlete.length > 0">
          <el-row :gutter="15">
            <el-col v-for="(item, andex) in athlete" :key="andex" :span="8" class="gl_padding_15">
              <PersonalImage :imgurl="item.imagePath" :imgheight="'50px'" />
              <p>{{ item.name }}</p>
            </el-col>
          </el-row>
        </div>
        <div v-else>
          暂无数据
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>

    <el-dialog title="编辑成绩" class="gl_dialog_TitleLine" :visible.sync="editingResults" width="660px">
      <div v-loading="peopleLoading" class="gl_my_10" style="min-height: 150px">
        <el-radio-group v-if="people && people.length > 0" v-model="peopleContent" size="mini" style="width: 94%;">
          <el-row :gutter="15">
            <el-col v-for="item in people" :key="item.registerId" :span="10" class="gl_mb_15">
              <el-radio class="radio" :label="item">
                <p>
                  <PersonalImage v-if="item.registerTypeCode == 'I'" :imgurl="item.avatar" :imgheight="'40px'" />
                  <img v-else :src="getStaticFileUrl(item.avatar)" class="object_img" @error="errorPhoto">
                  <el-popover v-if="item.registerTypeCode == 'I'" placement="bottom" width="300" trigger="hover" :content="item.competitionRegisterName">
                    <span slot="reference" class="people_name gl_pl_10">{{ item.competitionRegisterName }}</span>
                  </el-popover>
                  <el-popover v-else placement="bottom" width="300" trigger="hover" :content="item.registerNames">
                    <span slot="reference" class="people_name gl_pl_10">{{ item.registerNames }}</span>
                  </el-popover>
                </p>
              </el-radio>
            </el-col>
          </el-row>
        </el-radio-group>
        <div v-else>
          暂无数据
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="newLoading" size="mini" type="primary" @click="newPeople()">确 定</el-button>
        <el-button size="mini" @click="close()">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { Api_GET_EventsManagementEventResultEventRankListQO } from '@/lib/form/game/swaggerForm';
import defaultGameLogo from '@/assets/images/face_default.png';
import PersonalImage from '@/components/PersonalImage/index';
import {
  api_GET_EventsManagementCategory, // 获取项目类别列表
  api_GET_EventsManagementEventResultEventRankList, // 按类别查询奖牌榜
  api_GET_EventsManagementEventResultTeamMemberTeamRegisterId, // 获取队伍成员
  api_GET_EventsManagementEventIdEntryRegisters, // 获取项目报项人员/队伍列表
  api_POST_EventsManagementEventResultEventResult, // 添加项目名次
  api_PUT_EventsManagementEventResultEventResult, // 修改项目名次
  api_DELETE_EventsManagementEventResultEventResultEventResultId // 删除项目名次
} from '@/extend/api/gameswaggerApi/app.js';

export default {
  name: 'ObjectRank',
  components: {
    PersonalImage
  },
  data() {
    return {
      Api_GET_EventsManagementEventResultEventRankListQO: new Api_GET_EventsManagementEventResultEventRankListQO(),
      defaultGameLogo: defaultGameLogo,
      options: [],
      totalPage: 0, // 总条目数
      dialogVisible: false, // 成员信息弹窗
      loading: false,
      athleteLoading: false, // 成员信息
      peopleLoading: false, // 编辑成绩
      editingResults: false, // 编辑成绩弹窗
      newLoading: false, // 编辑成绩确定按钮
      peopleContent: {}, // 编辑成绩弹窗所选人员
      registerId: '',
      code: '', // 添加 or 更换
      people: [], // 编辑成绩人员列表
      eventResultId: '',
      eventId: '',
      peopleRank: 0,
      index: null, // 操作行的index
      eventType: [], // 项目选择下拉列表
      athlete: [], // 成员信息列表
      tableData: []
    };
  },
  created() {
    this.gameId = this.$route.params.id;
    this.Api_GET_EventsManagementEventResultEventRankListQO.MaxResultCount = 50;
    this.getCategory();
  },
  methods: {
    // 查询数据
    findEventTabelDataList(page) {
      var that = this;
      that.loading = true;
      that.Api_GET_EventsManagementEventResultEventRankListQO.CompetitionId = that.gameId;
      that.Api_GET_EventsManagementEventResultEventRankListQO.Page = page || 1;
      that.Api_GET_EventsManagementEventResultEventRankListQO.SkipCount = (that.Api_GET_EventsManagementEventResultEventRankListQO.Page - 1) * that.Api_GET_EventsManagementEventResultEventRankListQO.MaxResultCount;
      api_GET_EventsManagementEventResultEventRankList(that.Api_GET_EventsManagementEventResultEventRankListQO).then(res => {
        const data = res.items || [];
        that.tableData = that.handleReturnData(data);
        that.totalPage = res.totalCount;
        that.loading = false;
      }).catch(() => {
        that.loading = false;
        that.$message({ type: 'error', message: '获取奖牌榜失败！' });
      });
    },
    handleReturnData(data) {
      let newData = data.map(ktem => {
        return { ...ktem, isEdit: false };
      });
      newData = newData.map(item => {
        for (let i = 0; i < item.rankInfos.length; i++) {
          const list = item.rankInfos[i];
          if (list.memberNames) {
            let str = '';
            for (let j = 0; j < list.memberNames.length; j++) {
              const jtem = list.memberNames[j];
              str = str + jtem;
              if (j !== list.memberNames.length - 1) {
                str = str + '/' + ' ';
              }
            }
            list.memberNames = str;
          }
        }
        return { ...item };
      });
      const returnNewData = this.handleEvent(newData);
      return returnNewData;
    },
    errorPhoto() {
      const img = event.srcElement;
      img.src = this.defaultGameLogo;
    },
    // 获取项目列表
    getCategory() {
      api_GET_EventsManagementCategory({ competitionId: this.gameId }).then(res => {
        this.eventType = res.items;
        this.Api_GET_EventsManagementEventResultEventRankListQO.CategoryId = res.items[0].id;
        this.findEventTabelDataList();
      });
    },
    // 处理event
    handleEvent(eventInfos) {
      const returnEventInfos = [];
      for (let i = 0; i < eventInfos.length; i++) {
        const item = eventInfos[i];
        item._rankInfos = this.handleMedal(item.rankInfos);
        returnEventInfos.push(item);
      }
      return returnEventInfos;
    },
    // 处理medal
    handleMedal(rankInfos) {
      const returnRankInfo = {};
      for (let i = 0; i < rankInfos.length; i++) {
        const item = rankInfos[i];
        returnRankInfo['_' + item.rank] = returnRankInfo['_' + item.rank] || [];
        returnRankInfo['_' + item.rank].push(item);
      }
      return returnRankInfo;
    },
    // 团体的点击查看全部人员
    loooDetails(registerId, code) {
      if (code !== 'I') {
        this.dialogVisible = true;
        this.athleteLoading = true;
        api_GET_EventsManagementEventResultTeamMemberTeamRegisterId(registerId).then(res => {
          this.athlete = res;
          this.athleteLoading = false;
        }).catch(() => {
          this.athleteLoading = false;
          this.$message({ type: 'error', message: '获取成员信息失败！' });
        });
      }
    },
    // 获取静态文件地址
    getStaticFileUrl(relativeUrl) {
      if (!relativeUrl) return '';
      return WEB_CONFIG.VUE_APP_STATIC_FILE_RUL + relativeUrl;
    },
    // 编辑成绩
    isEdit(key, row) {
      row.isEdit = !row.isEdit;
      if (row.isEdit) {
        this.tableData.forEach((item, index) => {
          if (key !== index) {
            item.isEdit = false;
          }
        });
      }
      if (!row.isEdit) {
        this.findEventTabelDataList();
      }
    },
    // 删除人员
    removePeople(item, index) {
      var that = this;
      that.$confirm('您确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        api_DELETE_EventsManagementEventResultEventResultEventResultId(item.eventResultId).then(res => {
          that.$message({ type: 'success', message: '操作成功！' });
          const data = res.items || [];
          const row = that.handleReturnData(data);
          that.$set(that.$refs.rankTable.tableData, index, row[0]);
          that.tableData[index].isEdit = true;
        }).catch(() => {
          that.$message({ type: 'error', message: '操作失败！' + error.error && error.error.message });
        });
      }).catch(() => {});
    },
    // 获取可更换的人员列表，打开弹窗
    handlePeople(eventId, people, eventResultId, rank, index, code) {
      var that = this;
      that.peopleLoading = true;
      that.editingResults = true;
      that.code = code || '';
      let peopleIds = [];
      if (people && people.length > 0) {
        peopleIds = people.map((item) => {
          return item.registerId;
        });
      }
      api_GET_EventsManagementEventIdEntryRegisters(eventId).then(res => {
        if (res.items && res.items.length > 0) {
          that.people = res.items.filter((item) => {
            const isHas = peopleIds.some((jtem) => {
              return item.competitionRegisterId === jtem;
            });
            return !isHas;
          });
          that.people = that.people.map(item => {
            if (item.registerNames) {
              let strA = '';
              for (let a = 0; a < item.registerNames.length; a++) {
                const atem = item.registerNames[a];
                strA = strA + atem;
                if (a !== item.registerNames.length - 1) {
                  strA = strA + '/' + ' ';
                }
              }
              item.registerNames = strA;
            }
            return { ...item };
          });
          that.eventId = eventId;
          that.eventResultId = eventResultId;
          that.peopleRank = rank;
          that.index = index;
        }
        that.peopleLoading = false;
      }).catch(() => {
        that.peopleLoading = false;
        that.$message({ type: 'error', message: '获取人员列表失败！' });
      });
    },
    // 确认更换人员
    newPeople() {
      var that = this;
      that.newLoading = true;
      if (that.code === 'add') {
        // 添加
        const form = {
          eventId: that.eventId,
          competitionRegisterId: that.peopleContent.competitionRegisterId,
          rank: that.peopleRank
        };
        api_POST_EventsManagementEventResultEventResult(form).then(res => {
          if (res) {
            const data = res.items || [];
            const row = that.handleReturnData(data);
            that.$set(that.$refs.rankTable.tableData, that.index, row[0]);
            that.tableData[that.index].isEdit = true;
            that.close();
            that.$message({ type: 'success', message: '操作成功！' });
            that.newLoading = false;
          }
        }).catch((error) => {
          that.newLoading = false;
          that.$message({ type: 'error', message: '操作失败！' + error.error && error.error.message });
          that.close();
        });
      } else {
        // 修改
        const form = {
          eventResultId: that.eventResultId,
          competitionRegisterId: that.peopleContent.competitionRegisterId,
          rank: that.peopleRank
        };
        api_PUT_EventsManagementEventResultEventResult(form).then(res => {
          if (res) {
            const data = res.items || [];
            const row = that.handleReturnData(data);
            that.$set(that.$refs.rankTable.tableData, that.index, row[0]);
            that.tableData[that.index].isEdit = true;
            that.close();
            that.$message({ type: 'success', message: '操作成功！' });
            that.newLoading = false;
          }
        }).catch((error) => {
          that.newLoading = false;
          that.$message({ type: 'error', message: '操作失败！' + error.error && error.error.message });
          that.close();
        });
      }
    },
    // 关闭弹窗
    close() {
      this.editingResults = false;
      this.peopleContent = {};
    },
    // 分页
    sizeChange: function(MaxResultCount) {
      this.Api_GET_EventsManagementEventResultEventRankListQO.MaxResultCount = MaxResultCount; // 每页显示条目数
      this.findEventTabelDataList();
    },
    pageIndexChange(currentPage) {
      this.findEventTabelDataList(currentPage);
    }
  }
};
</script>
<style scoped>
.object_img{
  height: 40px;
  width: 40px;
  overflow: hidden;
  vertical-align: middle;
  display: inline-block;
}
.object_ank{
  margin-top:20px;
}
.name_box {
  width: 160px;
  overflow: hidden;
}
.item_name{
  width: 110px;
  /* position: relative;
  top: -5px; */
  vertical-align: middle;
  padding-left: 5px;
  margin-right: 5px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: inline-block;
}
.people_name{
  width: 160px;
  position: relative;
  top: 15px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: inline-block;
  vertical-align: top;
}
.radio /deep/ .el-radio__label{
  display: inline-block;
  vertical-align: middle;
}
.operation {
  cursor: pointer;
  color: #f56c6c;
}
.athlete_box {
  /* display:flex;
  justify-content: center;
  align-content: center; */
  text-align: center;
}
/* .el-table /deep/ .cell {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
} */
.el-table /deep/ .cell p{
  white-space: nowrap;
}
</style>
